#!/usr/bin/python3.8.9
# -*- coding: utf-8 -*-

# @Author  : Tina Yu
# @Time    : 2022-1-9 14:26
import yaml


def get_yaml_data(file_path, key=None):
    with open(file_path, 'r', encoding='utf-8') as f:
        yaml_data = yaml.safe_load(f)
        if key is None:
            return yaml_data
        else:
            data_with_key = yaml_data.get(key)
            return data_with_key


if __name__ == '__main__':
    data_file_name1 = 'D:/python_workspace/autotest/homework/task_app/test_datas/member_info.yml'
    data1 = get_yaml_data(data_file_name1)
    print(f'data1为：{data1}')

